﻿@model IEnumerable<ArivisTests.Models.TestRun>

@{
    ViewBag.Title = "Index";
}

@section Navigation{
    Test Runs
}

<table class="index-table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Date)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Progress)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Results)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model.OrderByDescending(x => x.Active).ThenByDescending(x => x.Date)) {
    <tr>
        <td>
            @Html.ActionLink(item.Name, "Details", new { id=item.Id })
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
            @if (item.Active)
            {
                <text>(Active)</text>
            }
        </td>
        <td>
            @item.Progress
        </td>
        <td>
            @item.Results
        </td>
        <td style="white-space:nowrap; width:1%">
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>
<p>
    @Html.ActionLink("Create New", "Create")
</p>
